package com.star.mapper;

import com.github.pagehelper.Page;
import com.star.dto.BusinessPageQueryDTO;
import com.star.dto.UserPageQueryDTO;
import com.star.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where phone = #{phone}")
    User getByPhone(String openid);

    /**
     * 根据id查询用户
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{id}")
    User getById(Long userId);
    /**
     * 插入新用户
     * @param user
     */
    void insert(User user);

    /**
     * 根据动态条件统计指定时间内的用户数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);

    /**
     * 修改用户信息
     * @param userDB
     */
    void update(User userDB);

    Page<User> pageQuery(UserPageQueryDTO userPageQueryDTO);
}
